import { IPSControlItemParam } from './ipscontrol-item-param';
import { IPSSysImage } from '../res/ipssys-image';
import { IPSUIAction } from '../view/ipsuiaction';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSControlItemParamProxy extends PSModelObjectImpl implements IPSControlItemParam {
  get caption(): string {
    return this.M.caption;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get key(): string {
    return this.M.key;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssysimage: IPSSysImage | null = null;

  getPSSysImage(): IPSSysImage | null {
    if (this.pssysimage != null) return this.pssysimage;
    const value = this.M.getPSSysImage;
    if (value == null) {
      return null;
    }
    this.pssysimage = this.getPSModel4('res.IPSSysImage', value, 'getPSSysImage') as IPSSysImage;
    return this.pssysimage;
  }

  get psSysImage(): IPSSysImage | null {
    return this.getPSSysImage();
  }

  getPSSysImageMust(): IPSSysImage {
    const value = this.getPSSysImage();
    if (value == null) {
      throw new Error('未指定系统图片');
    }
    return value;
  }

  protected psuiaction: IPSUIAction | null = null;

  getPSUIAction(): IPSUIAction | null {
    if (this.psuiaction != null) return this.psuiaction;
    const value = this.M.getPSUIAction;
    if (value == null) {
      return null;
    }
    this.psuiaction = this.getPSModel4('view.IPSUIAction', value, 'getPSUIAction') as IPSUIAction;
    return this.psuiaction;
  }

  get psUIAction(): IPSUIAction | null {
    return this.getPSUIAction();
  }

  getPSUIActionMust(): IPSUIAction {
    const value = this.getPSUIAction();
    if (value == null) {
      throw new Error('未指定调用界面行为');
    }
    return value;
  }

  get tooltip(): string {
    return this.M.tooltip;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get value(): string {
    return this.M.value;
  }

  get cls(): string {
    return 'PSControlItemParamProxy';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.IPSControlItemParam') return true;
    return super.instanceof(cls);
  }
}
